package org.lex.app;

import java.io.File;

import org.lex.app.prefs.ResourceManager;
import org.lex.app.prefs.ResourceMap;


public class SharedApplicationContext {
	private LocalStorage localStorage = null;
	private SessionStorage sessionStorage = null;
	private ResourceManager resourceManager = null;

	public SharedApplicationContext(String appid) {
		this.localStorage = new LocalStorage(appid);
		// initialize session-storage
		File apphome = localStorage.getApplicationHome();
		this.sessionStorage = new SessionStorage(apphome, appid);
		this.resourceManager = new ResourceManager(apphome, appid);
	}

	public LocalStorage getLocalStorage() {
		return this.localStorage;
	}

	public SessionStorage getSessionStorage() {
		return sessionStorage;
	}

	public ResourceMap getResourceMap() {
		return this.getResourceManager().getResourceMap();
	}

	public ResourceManager getResourceManager() {
		return this.resourceManager;
	}
}
